<%@ page import="java.util.List" %>
<%@ page import="com.foreknow.bean.Guestbook" %><%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/12/1
  Time: 10:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>

<body>
   <div class="container">
       <table class="table table-hover">
           <tr>
               <td>id</td>
               <td>name</td>
               <td>phone</td>
               <td>email</td>
               <td>title</td>
               <td>content</td>
               <td>createdtime</td>
               <td>操作</td>
           </tr>
<%--           <%--%>
<%--               //Java代码部分--%>
<%--               //从request中获取到list集合，然后遍历集合--%>
<%--               List<Object> list =( List<Object>)request.getAttribute("list");--%>
<%--               for(int i = 0;i<list.size();i++){--%>
<%--                   Guestbook gb = (Guestbook) list.get(i);--%>
<%--           %>--%>
            <%--  items接收一个集合 ${requestScope.list}  ${list}  var表示变量的名称         --%>
           <c:forEach var="gb" items="${requestScope.list}" varStatus="status">
               <tr>
                   <td>${status.index+1}</td>
                   <td>${gb.name}</td>
                   <td>${gb.phone}</td>
                   <td>${gb.email}</td>
                   <td>${gb.title}</td>
                   <td>${gb.content}</td>
                   <td>${gb.createdtime}</td>
                   <td>
                       <a href="/UserManagerWeb_war_exploded/manager?q=jump" class="btn btn-primary">添加</a>
                       <a href="/UserManagerWeb_war_exploded/servlet资源地址?q=update" class="btn btn-success">修改</a>
                       <a href="/UserManagerWeb_war_exploded/manager?q=delete&id=${gb.id}" class="btn btn-danger">删除</a>
                   </td>
               </tr>
           </c:forEach>
<%--           <%--%>
<%--               }--%>
<%--           %>--%>

       </table>
   </div>

</body>
</html>
